import java.util.*;
import java.text.*;
public class WeekDay {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		System.out.println("Enter the date:");
		ParsePosition pos = new ParsePosition(0);
		SimpleDateFormat checkFormat = new SimpleDateFormat("dd MMMMM yyyy");
		SimpleDateFormat resultFormat = new SimpleDateFormat("EEEE");
		String date;
		String day;
		Date parsedDate = new Date();
		while (true) {
			date = in.nextLine();
			try{
				parsedDate = checkFormat.parse(date, pos);
				day = resultFormat.format(parsedDate);
			} catch (NullPointerException pe){
				System.out.println("invalid format");
				continue;
			}
			//for successful date test
			break;
		}
		System.out.println(day);
	}
}
